package com.peanut.controller;

import com.peanut.model.*;
import com.peanut.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller

public class WebController {
    @Autowired
    private HomeService homeService;
    @Autowired
    private AboutUsService aboutUsService;
    @Autowired
    private CaseService caseService;
    @Autowired
    private NewsService newsService;
    @Autowired
    private RecruitmentService recruitmentService;
    @Autowired
    private OnlineService onlineService;
    @Autowired
    private CallusService callusService;


    //首页
    @ResponseBody
    @RequestMapping(value = "/home",method = RequestMethod.GET)
    public ResultModel Home(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(homeService.getHomeModel());
        return resultModel;
    }
    //关于我们
    @ResponseBody
    @RequestMapping(value = "/aboutUs",method = RequestMethod.GET)
    public ResultModel aboutUs(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(aboutUsService.getAboutUs());
        return resultModel;
    }
    //工程案例
    @ResponseBody
    @RequestMapping(value = "/case",method = RequestMethod.GET)
    public ResultModel getCase(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(caseService.getCaseList());
        return resultModel;
    }
    @ResponseBody
    @RequestMapping(value = "/news",method = RequestMethod.GET)
    public ResultModel getNewsList(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(newsService.getNewsList());
        return resultModel;
    }
    @ResponseBody
    @RequestMapping(value = "/recruitment",method = RequestMethod.GET)
    public ResultModel getRecruitment(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(recruitmentService.getRecruitment());
        return resultModel;
    }
    @ResponseBody
    @RequestMapping(value = "/callus",method = RequestMethod.GET)
    public ResultModel getCallus(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(callusService.getCallus());
        return resultModel;
    }
    @ResponseBody
    @RequestMapping(value = "/online",method = RequestMethod.GET)
    public ResultModel getOnline(){
        ResultModel resultModel =new ResultModel();
        resultModel.setObject(onlineService.getOnline());
        return resultModel;
    }
}
